package day14.homework02.test02;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author Xiao
 * @date 2021/8/7
 */
public class Test02 {
    /**
     * 2. 死锁实现
     */
    public static void main(String[] args) {
        Lock lock1 = new ReentrantLock();
        Lock lock2 = new ReentrantLock();
        Boy boy = new Boy(lock1, lock2);
        Girl girl = new Girl(lock2, lock1);
        Thread tboy = new Thread(boy);
        Thread tgirl = new Thread(girl);
        tboy.start();
        tgirl.start();
    }
}
